package com.pwc.common.Util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;


/**
 * time modules
 * @author whuang072
 *
 */
public class Time {
    
    public static int getYear()
    {
    	return Calendar.getInstance().get(Calendar.YEAR);
    }
    
    public static int getMonth()
    {
    	return Calendar.getInstance().get(Calendar.MONTH)+1;
    }
    
    
    public static int getDay()
    {
    	return Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
    }
    
    public static int getHour()
    {
    	return Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
    }
    
    
    public static int getMinute()
    {
    	return Calendar.getInstance().get(Calendar.MINUTE);
    }
    
    
    public static int getSecond()
    {
    	return Calendar.getInstance().get(Calendar.SECOND);
    }
    
    public static String getTime()
    {
    	return getDateTime("HH:mm:ss");
    }
    
    public static String getDate()
    {    	
    	return getDateTime("yyyy-MM-dd");
    }
    
    public static String getDateTime()
    {    	
    	return getDateTime("yyyy-MM-dd HH:mm:ss");
    }


    public static String getDateTime(String dateTimeFormate)
    {
    	DateFormat date = new SimpleDateFormat(dateTimeFormate);
    	return date.format(Calendar.getInstance().getTime());
    }
    
    public static Long getTimeInMillis()
    {
    	return Calendar.getInstance().getTimeInMillis();
    }


}
